<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>在使用子组件的数据时改变结构外表标签</title>
</head>

<body>
    <div id="app">
        <cpn>
            <template slot-scope="slot">
                <span>{{slot.data.join(' * ')}}</span>

            </template>
        </cpn>

    </div>
    <template id="cpn">
        <div>
            <h2>模板</h2>
            <slot :data="codeLanguage">
                <ul>
                    <li v-for=" item in codeLanguage ">
                        {{item}}
                    </li>
                </ul>
            </slot>


        </div>
    </template>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data() {
                return { 
                    message: 'Hello Vue!' 
                    }
            },
            components: {
                cpn: {
                    template: "#cpn",
                    data() {
                        return {
                            codeLanguage: ['java', 'c++', 'python', 'javascript']
                        }
                    }
                }
            }
        })
    </script>
</body>

</html>